package arch.dao.impl.archive;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import arch.dao.archive.SecurityDao;
import arch.domain.archive.Security;

/**
 * 
 * @author <a mailto="hwangsyin@gmail.com">King</a>
 *
 */
@Repository("securityDao")
public class SecurityDaoImpl implements SecurityDao {
	@Resource private JdbcTemplate jdbcTemplate;
	
	@SuppressWarnings("unchecked")
	public List<Security> list(String sql, Object... args) {
		List<Security> result = null;
		
		if(sql != null && !"".equals(sql.trim())) {
			result = (List<Security>)this.jdbcTemplate.query(sql, args, new SecurityRowMapper());
		}
		
		return result;
	}
	public Long queryForInteger(String sql, Object... args) {
		Long result = null;
		if(sql != null && !"".equals(sql.trim())) {
			result = (long)jdbcTemplate.queryForInt(sql, args);
		}
		return result;
	}
	public void update(String sql, Object... args) {
		if(sql != null && !"".equals(sql.trim())) {
			jdbcTemplate.update(sql, args);
		}
	}

}
